﻿<%@ Page Language="C#" AutoEventWireup="false" Inherits="Web.BasePage"%>
<%@ Import Namespace="System.Collections.Generic" %>
<%@ Import Namespace="MAF.Common" %>
<%@ Import Namespace="Web.Controller" %>
<%@ Import Namespace="Domain.Entities" %>
<%@ Import Namespace="Web.UI" %>

<% 
    string catName = ModuleTranslate(Module);
    string parentId = Request.QueryString["ParentId"];
    if( !string.IsNullOrEmpty(parentId) )
    {
        CategoryInfo cat = Business.BusinessFactory.CreateCategory(Module).Show(new Guid(parentId));
        if (null != cat)
            catName = cat.Name;
    }
%>
<div id="news-list" class="box">
    <b class="rc-tp"><b></b></b>
    <span class="shadow"></span>
    <div class="hd">
        <span class="icon"></span>
        <h2><%=catName %></h2>
    </div>
    <div class="bd clearfix">

<!-- contents -->
<% if( SecurityUI.IsMaintainMode(null) ){ %>
    <a href="Part.aspx?Module=<%=Module %>&Handler=Article&Action=New" class="btn-add-article">添加文章</a>
<%} %>

<ul class="clearfix">
<% 
    PageInfo page;
    ArticleHandler h = new ArticleHandler();
    IList<ArticleInfo> list = h.Index(out page);

    foreach (ArticleInfo info in list)
    {
%>
    <li>
        <%--<input type="checkbox" name="Id" value="<%=info.Id %>" />--%>
        <a href="Default.aspx?Module=<%=Module %>&Handler=Article&Action=Show&Id=<%=info.Id %>"><%= info.Name %></a>
        <% if( SecurityUI.IsMaintainMode(null) ){ %>
        <a href="Part.aspx?Module=<%=Module %>&Handler=Article&Action=Edit&Id=<%=info.Id %>" class="btn-update-article">编辑</a>
        <a href="Part.aspx?Module=<%=Module %>&Handler=Article&Action=Delete&Id=<%=info.Id %>" class="btn-delete-article">删除</a>
        <%} %>
    </li>
<% 
    }
%>
</ul>

<div class="green-black ">
<%
    // 分页导航条
    if (null != page)
    {
        WebPageNavigator nav = new WebPageNavigator(page, Request.QueryString);
        Response.Write(nav.ToString());
    }
%>
</div>
<!-- // contents -->

    </div>
</div>